/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.db;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "obj_structuredfund_base")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ObjStructuredFundBase.findAll", query = "SELECT o FROM ObjStructuredFundBase o"),
    @NamedQuery(name = "ObjStructuredFundBase.findByObj", query = "SELECT o FROM ObjStructuredFundBase o WHERE o.obj = :obj"),
    @NamedQuery(name = "ObjStructuredFundBase.findByName", query = "SELECT o FROM ObjStructuredFundBase o WHERE o.name = :name"),
    @NamedQuery(name = "ObjStructuredFundBase.findByMarketCode", query = "SELECT o FROM ObjStructuredFundBase o WHERE o.marketCode = :marketCode"),
    @NamedQuery(name = "ObjStructuredFundBase.findByFundManagementCompany", query = "SELECT o FROM ObjStructuredFundBase o WHERE o.fundManagementCompany = :fundManagementCompany"),
    @NamedQuery(name = "ObjStructuredFundBase.findByUnderlyingIndex", query = "SELECT o FROM ObjStructuredFundBase o WHERE o.underlyingIndex = :underlyingIndex"),
    @NamedQuery(name = "ObjStructuredFundBase.findByTradingdate", query = "SELECT o FROM ObjStructuredFundBase o WHERE o.tradingdate = :tradingdate"),
    @NamedQuery(name = "ObjStructuredFundBase.findByOwnUserID", query = "SELECT o FROM ObjStructuredFundBase o WHERE o.ownUserID = :ownUserID"),
    @NamedQuery(name = "ObjStructuredFundBase.findByAlterUserID", query = "SELECT o FROM ObjStructuredFundBase o WHERE o.alterUserID = :alterUserID"),
    @NamedQuery(name = "ObjStructuredFundBase.findByCreateTime", query = "SELECT o FROM ObjStructuredFundBase o WHERE o.createTime = :createTime"),
    @NamedQuery(name = "ObjStructuredFundBase.findByTimeStamp", query = "SELECT o FROM ObjStructuredFundBase o WHERE o.timeStamp = :timeStamp")})
public class ObjStructuredFundBase implements Serializable {
	public static byte[] EnCode(ObjStructuredFundBase msg) throws IOException {
		Codec<ObjStructuredFundBase> Lcode = ProtobufProxy.create(ObjStructuredFundBase.class);
		return Lcode.encode(msg);
	}
	public static ObjStructuredFundBase DeCode(byte[] data) throws IOException {
	Codec<ObjStructuredFundBase> Lcode = ProtobufProxy.create(ObjStructuredFundBase.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Obj")
    @Protobuf
	private String obj;
    @Basic(optional = false)
    @Column(name = "Name")
    private String name;
	@Protobuf
	private byte[] nameBit;
    @Basic(optional = false)
    @Column(name = "MarketCode")
    @Protobuf
	private String marketCode;
    @Column(name = "FundManagementCompany")
    private String fundManagementCompany;
	@Protobuf
	private byte[] fundManagementCompanyBit;
    @Column(name = "UnderlyingIndex")
    @Protobuf
	private String underlyingIndex;
    @Column(name = "tradingdate")
    @Temporal(TemporalType.DATE)
    private Date tradingdate;
	@Protobuf
	private long tradingdateL;
    @Column(name = "OwnUserID")
    @Protobuf
	private String ownUserID;
    @Column(name = "AlterUserID")
    @Protobuf
	private String alterUserID;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public ObjStructuredFundBase() {
    }

    public ObjStructuredFundBase(String obj) {
        this.obj = obj;
    }

    public ObjStructuredFundBase(String obj, String name, String marketCode) {
        this.obj = obj;
        this.name = name;
		this.nameBit = CodeTool.StringToBit(name);
        this.marketCode = marketCode;
    }

    public String getObj() {
        return obj;
    }

    public void setObj(String obj) {
        this.obj = obj;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
        this.setNameBit(CodeTool.StringToBit(name));
    }

    public String getMarketCode() {
        return marketCode;
    }

    public void setMarketCode(String marketCode) {
        this.marketCode = marketCode;
    }

    public String getFundManagementCompany() {
        return fundManagementCompany;
    }

    public void setFundManagementCompany(String fundManagementCompany) {
        this.fundManagementCompany = fundManagementCompany;
		this.setFundManagementCompanyBit(CodeTool.StringToBit(fundManagementCompany));
    }

    public String getUnderlyingIndex() {
        return underlyingIndex;
    }

    public void setUnderlyingIndex(String underlyingIndex) {
        this.underlyingIndex = underlyingIndex;
    }

    public Date getTradingdate() {
        return tradingdate;
    }

    public void setTradingdate(Date tradingdate) {
        this.tradingdate = tradingdate;
		this.setTradingdateL(CodeTool.DateToLong(tradingdate));
    }

    public String getOwnUserID() {
        return ownUserID;
    }

    public void setOwnUserID(String ownUserID) {
        this.ownUserID = ownUserID;
    }

    public String getAlterUserID() {
        return alterUserID;
    }

    public void setAlterUserID(String alterUserID) {
        this.alterUserID = alterUserID;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (obj != null ? obj.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ObjStructuredFundBase)) {
            return false;
        }
        ObjStructuredFundBase other = (ObjStructuredFundBase) object;
        if ((this.obj == null && other.obj != null) || (this.obj != null && !this.obj.equals(other.obj))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.db.ObjStructuredFundBase[ obj=" + obj + " ]";
    }

    public byte[] getNameBit() {
        return nameBit;
    }

    public void setNameBit(byte[] nameBit) {
        this.nameBit = nameBit;
		this.name = CodeTool.BitToString(nameBit);
    }

    public byte[] getFundManagementCompanyBit() {
        return fundManagementCompanyBit;
    }

    public void setFundManagementCompanyBit(byte[] fundManagementCompanyBit) {
        this.fundManagementCompanyBit = fundManagementCompanyBit;
		this.fundManagementCompany = CodeTool.BitToString(fundManagementCompanyBit);
    }

    public long getTradingdateL() {
        return tradingdateL;
    }

    public void setTradingdateL(long tradingdateL) {
        this.tradingdateL = tradingdateL;
		this.tradingdate = CodeTool.LongToDate(tradingdateL);
    }
    
}
